package com.ygy.marketdata;

import lombok.Data;

import java.math.BigDecimal;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;

@Data
public class KLine {
    private final ZonedDateTime openTime;
    private final BigDecimal open;
    private final BigDecimal high;
    private final BigDecimal low;
    private final BigDecimal close;
    private final BigDecimal volume;
    private final BigDecimal volumeDelta;

    public KLine(long openTime, String open, String high, String low, String close, String volume, String volumeDelta) {
        this.openTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(openTime), ZoneId.systemDefault());
        this.open = new BigDecimal(open);
        this.high = new BigDecimal(high);
        this.low = new BigDecimal(low);
        this.close = new BigDecimal(close);
        this.volume = new BigDecimal(volume);
        this.volumeDelta = new BigDecimal(volumeDelta);
    }

}